package NewCode;

import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        String input=scan.nextLine();
        String[] strNum = input.split(",");
        float sum=0f;
        for (int i = 0; i < strNum.length-1; i++) {
            float a=Float.parseFloat(strNum[i+1].toString());
            float b=Float.parseFloat(strNum[i].toString());
            if(a>b){
                sum+=a-b;
            }
        }
        System.out.println(sum);
    }
}
